




#include <Ogre.h>
#include "OgreInterface.h"
#include <string>
#include <iostream>

using namespace std;




void OgreInterface::createLight( char *type, float x, float y, float z ) {

    //Create an Ogre "light type" object
    Light::LightTypes typeLabel;
    //Cast the input argument to a string for comparison
    string typeString( type );

    //Figure out what type of light is needed and set the lighttype accordingly
    if( typeString.compare( "point" ) == 0 ) {
        typeLabel = Light::LT_POINT;
    }
    else if ( typeString.compare( "spot" ) == 0 ) {
        typeLabel = Light::LT_SPOTLIGHT;
    }
    else if ( typeString.compare( "directional" ) == 0 ) {
        typeLabel = Light::LT_DIRECTIONAL;
    }
    else {
        std::cerr << "**ERROR**" << std::endl
                  << "Light type is either not supported or mis-spelled." << std::endl
                  << "Supported types (lower-case): " << std::endl
                  << "spot" << std::endl
                  << "point" << std::endl
                  << "directional" << std::endl;
    }



    Light* myLight = mSceneMgr->createLight("Light0");
    myLight->setType(typeLabel);
    myLight->setPosition( x, y, z );
    //Leave the colors white by default
    myLight->setDiffuseColour(1, 1, 1);
    myLight->setSpecularColour(1, 1, 1);

}
